home *** CD-ROM | disk | FTP | other *** search
File List | 1995-01-30 | 3.7 KB | 202 lines |
- MODE 1
- '
- ' Plutonic Outbound Purger
- '
- ' This source is copyright! All rights reserved.
- '
- ' If any parts of it are used in other programs, acknowledgement
- ' must be given to Peter Deane (3:622/401)
- '
- ' Only keeps today's 0-byte files in outbound.
- '
- argprob%=0
- arg$=_dosCmd$
- arg$=TRIM$(arg$)
- IF arg$=""
- arg$="Mail:Outbound"
- ENDIF
- '
- versnum$="$VER: PlutPurge 0.5 (30-Jan-95)kyj"
- versnum$="0.5"
- versdate$="30-Jan-95"
- '
- esc$=CHR$(27)
- ansi0$=esc$+"[0m"
- ansi1$=esc$+"[31m"
- ansi2$=esc$+"[32m"
- ansi3$=esc$+"[33m"
- bold$=esc$+"[1m"
- ital$=esc$+"[3m"
- under$=esc$+"[4m"
- '
- numkill%=0
- '
- OPEN "O",#1,"*",1
- '
- IF INSTR(arg$,"?")
- argprob%=9
- ELSE IF LEN(arg$)<3
- argprob%=1
- ELSE IF NOT EXIST(arg$)
- argprob%=2
- ENDIF
- '
- PRINT #1,""
- PRINT #1,ansi2$+"---------------"
- PRINT #1,ansi0$+bold$+"Plutonic Purger"+ansi0$
- PRINT #1,ansi2$+"---------------"
- PRINT #1,under$+ansi0$+"Version "+ansi3$+versnum$+ansi0$
- PRINT #1,ital$+" (c) "+ansi3$+versdate$+ansi0$
- PRINT #1,bold$;" By Peter Deane"+ansi0$
- PRINT #1,ansi2$+"---------------"+ansi0$
- RELSEEK #1,0
- '
- IF argprob%>0
- '
- PRINT #1,""
- IF argprob%=1
- PRINT #1,"Short or no directory name given"
- ELSE IF argprob%=2
- PRINT #1,"Given directory does not exist"
- ELSE IF argprob%=9
- PRINT #1,CHR$(34)+"?"+CHR$(34)+" given in command line"
- ENDIF
- PRINT #1,bold$+ansi3$+"Usage details: ";
- PRINT #1,ansi2$+"PlutPurge "+ital$+"<directory>"+ansi0$
- GOTO cleanup
- ENDIF
- '
- IF RIGHT$(arg$,1)<>"/" AND RIGHT$(arg$,1)<>":"
- arg$=arg$+"/"
- ENDIF
- '
- @gimmetheday
- keep$="."+LEFT$(today$,2)
- keep$=UPPER$(keep$)
- '
- PRINT #1
- PRINT #1,"Scanning dir: "+CHR$(34)+arg$+CHR$(34)+" this fine "+today$+"..."
- RELSEEK #1,-1
- '
- DIR arg$ TO "ram:PlutPurge.tmp"
- IF NOT EXIST("Ram:PlutPurge.tmp")
- PRINT #1,"No files in search directory"
- RELSEEK #1,-1
- GOTO cleanup
- ENDIF
- '
- OPEN "I",#3,"Ram:PlutPurge.tmp",1024
- PRINT #1,""
- RELSEEK #1,-1
- WHILE NOT EOF(#3)
- lq%=0
- LINE INPUT #3,xx$
- PRINT #1,xx$;
- RELSEEK #1,-1
- '
- xk$=arg$+xx$+CHR$(0)
- xop%=Lock(V:xk$,-1)
- IF xop%<>0
- ~UnLock(xop%)
- OPEN "I",#9,arg$+xx$,24
- lq%=LOF(#9)
- CLOSE #9
- ENDIF
- IF lq%=0
- '
- xxu$=UPPER$(xx$)
- spc%=24-LEN(xx$)
- IF spc%<1
- spc%=1
- ENDIF
- PRINT #1,SPACE$(spc%);
- IF INSTR(xxu$,keep$)
- PRINT #1," <- "+ansi2$+"Today's"+ansi0$
- ELSE
- xk$=arg$+xx$+CHR$(0)
- xop%=Lock(V:xk$,-1)
- IF xop%<>0
- ~UnLock(xop%)
- KILL arg$+xx$
- INC numkill%
- PRINT #1," <- "+ansi3$+"Deleted!"+ansi0$
- ELSE
- PRINT #1," <- Locked - not deleted"+ansi0$
- ENDIF
- ENDIF
- RELSEEK #1,-1
- ELSE
- PRINT #1,CHR$(10)+esc$+"[A"+esc$+"[K";
- RELSEEK #1,-1
- ENDIF
- WEND
- CLOSE #3
- '
- cleanup:
- '
- PRINT #1,"Deleted "+STR$(numkill%)+" files."
- PRINT #1,""
- PRINT #1,ansi3$+"Peter Deane"
- PRINT #1,ansi0$+"PO Box 228"
- PRINT #1,"Swansea NSW 2281 Australia."
- PRINT #1,bold$+ansi3$+"Fido: "+ansi2$+"3:622/401"+ansi0$
- '
- IF EXIST("Ram:PlutPurge.tmp")
- KILL "RAM:PlutPurge.tmp"
- ENDIF
- '
- CLOSE #1
- END
- '
- '
- PROCEDURE gimmetheday
- '
- dshold%=AllocMem(12,0)
- ' Can one assume that 12 bytes can always get allocated? I am here!
- ~DateStamp(dshold%)
- xd%=LPEEK(dshold%)
- ~FreeMem(dshold%,12)
- dd%=xd% MOD 7
- SELECT dd%
- CASE 0
- today$="Sunday"
- CASE 1
- today$="Monday"
- CASE 2
- today$="Tuesday"
- CASE 3
- today$="Wednesday"
- CASE 4
- today$="Thursday"
- CASE 5
- today$="Friday"
- CASE 6
- today$="Saturday"
- ENDSELECT
- '
- RETURN
- '
- '
- PROCEDURE spaceout(thing$,col%)
- '
- LOCAL xx$,xx%,xq%,result%
- '
- xx%=FRE(1)
- ' [Needs the string to format, and the column width it's going to]
- ' [Returns spc% - the number of spaces required - 1 if field overflow]
- '
- xx$=thing$
- xx%=col%
- xq%=LEN(xx$)
- '
- IF xq%>xx%
- result%=1
- ELSE
- result%=(xx%-xq%)
- ENDIF
- '
- spc%=result%
- '
- RETURN
- '
-